{include file='../__header.tpl'}
        {if $ed}
            <input type="hidden" value="{$pd.product_id}" id="pid" /> 
        {/if}
        <input type="hidden" value="{$mod}" id="mod" /> 
        <input type="hidden" value="{$smarty.server.HTTP_REFERER}" id="http_referer" /> 
        <i id="scriptTag">page_iframe_alter_product</i>
        <form id="pd-baseinfo" style="padding-bottom: 70px;">
            <div style="padding: 22px;" class="clearfix">

                <input id="pd-catimg" name="catimg" type="hidden" value="{$pd.catimg}" />
                <input id="pd-serial-val" type="hidden" value="{$pd.product_serial}" />
                <input id="pd-form-cat" type="hidden" value="{$cat}" />
                {foreach from=$pd.images item=pdi}
                    <input class="pd-images" type="hidden" value="{$pdi.image_path}" data-sort="{$pdi.image_sort}" />
                {/foreach}

                <div class="clearfix">

                    <div id="alterProductLeft">

                        <!-- 商品名称 -->
                        <div class="fv2Field clearfix">
                            <div class="fv2Left">
                                <span>商品名称</span>
                            </div>
                            <div class="fv2Right">
                                <input type="text" class="gs-input" name="product_name" value="{if $ed}{$pd.product_name}{/if}" id="pd-form-title" autofocus/>
                            </div>
                        </div>

                        <!-- 商品简称 -->
                        <div class="fv2Field clearfix">
                            <div class="fv2Left">
                                <span>商品简称</span>
                            </div>
                            <div class="fv2Right">
                                <input type="text" class="gs-input" name="product_subname" id="pd-form-subname" value="{if $ed}{$pd.product_subname}{/if}"/>
                            </div>
                        </div>      

                        <!-- 商品编号 -->
                        <div class="fv2Field clearfix">
                            <div class="fv2Left">
                                <span>商品编号</span>
                            </div>
                            <div class="fv2Right">
                                <input type="text" class="gs-input" name="product_code" onclick="this.select();" value="{if $ed}{$pd.product_code}{/if}" id="pd-form-code" />
                            </div>
                        </div>   

                        <!-- 商品简介 -->
                        <div class="fv2Field clearfix">
                            <div class="fv2Left">
                                <span>商品简介</span>
                            </div>
                            <div class="fv2Right">
                                <span class="frm_textarea_box" style="width: 377px;"><textarea class="js_desc frm_textarea" id="pd-form-desc" name="product_subtitle">{if $ed}{$pd.product_subtitle}{/if}</textarea></span>
                            </div>
                        </div>

                        <!-- 商品分类 -->
                        <div class="fv2Field clearfix">
                            <div class="fv2Left">
                                <span>商品分类</span>
                            </div>
                            <div class="fv2Right">
                                {strip}
                                    <select id="pd-catselect" style="color:#000" name="product_cat" >
                                        {if $categorys|count > 0}
                                            {foreach from=$categorys item=cat1}
                                                <option value="{$cat1.dataId}" {if $cat1.hasChildren}disabled{/if}>{$cat1.name}</option>
                                                {foreach from=$cat1.children item=cat2}
                                                    <option value="{$cat2.dataId}" {if $cat2.hasChildren}disabled{/if}>-- {$cat2.name}</option>
                                                    {foreach from=$cat2.children item=cat3}
                                                        <option value="{$cat3.dataId}" {if $cat3.hasChildren}disabled{/if}>---- {$cat3.name}</option>
                                                        {foreach from=$cat3.children item=cat4}
                                                            <option value="{$cat4.dataId}" {if $cat4.hasChildren}disabled{/if}>------ {$cat4.name}</option>
                                                        {/foreach}
                                                    {/foreach}
                                                {/foreach}
                                            {/foreach}
                                        {else}
                                            <option value="0">未分类</option>
                                        {/if}
                                    </select>
                                {/strip}
                            </div>
                        </div>   

                        <!-- 商品品牌 -->
                        <div class="fv2Field clearfix">
                            <div class="fv2Left">
                                <span>商品品牌</span>
                            </div>
                            <div class="fv2Right">
                                <select id="pd-serial" name="product_brand">
                                    <option value="0" {if $pd.product_brand eq 0}selected{/if}>默认</option>
                                    {foreach from=$brands item=ser}
                                        <option value="{$ser.id}" {if $pd.product_brand eq $ser.id}selected{/if}>{$ser.brand_name}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>    

                        <!-- 商品价格 -->
                        <div class="fv2Field clearfix">
                            <div class="fv2Left">
                                <span>商品价格(元)</span>
                            </div>
                            <div class="fv2Right">
                                <input type="text" class="gs-input" onclick="this.select();" value="{if $ed}{$pd.sale_prices}{else}0.00{/if}" id="pd-form-prices" /> 
                            </div>
                        </div>    

                        <!-- 商品品牌 -->
                        <div class="fv2Field clearfix">
                            <div class="fv2Left">
                                <span>市场参考价</span>
                            </div>
                            <div class="fv2Right">
                                <input type="hidden" id="pd-form-discount" value="{if $ed}{$pd.discount}{else}100{/if}"/>
                                <input type="text" class="gs-input" name="market_price" onclick="this.select();" value="{if $ed and $pd.market_price}{$pd.market_price}{else}0.00{/if}" id="market_price" />
                            </div>
                        </div>   

                        <!-- 商品重量 -->
                        <div class="fv2Field clearfix">
                            <div class="fv2Left">
                                <span>商品重量(g)</span>
                            </div>
                            <div class="fv2Right">
                                <input type="text" class="gs-input" name="product_weight" id="pd-form-weight" value="{if $ed > 0}{$pd.product_weight}{else}0{/if}"/>
                                <div class='fv2Tip'>订单运费计算必备参数，0为默认包邮，单位：克</div>
                            </div>
                        </div>

                        {*                <!-- 积分奖励 -->
                        <div class="fv2Field clearfix">
                        <div class="fv2Left">
                        <span>积分奖励(点)</span>
                        </div>
                        <div class="fv2Right">
                        <input type="text" class="gs-input" name="product_credit" id="pd-form-credit" value="{if $ed > 0}{$pd.product_credit}{else}0{/if}"/>
                        <div class='fv2Tip'>用户购买商品之后，奖励的积分数量</div>
                        </div>
                        </div>*}

                        <!-- 积分奖励 -->
                        <div class="fv2Field clearfix">
                            <div class="fv2Left">
                                <span>商品秒杀</span>
                            </div>
                            <div class="fv2Right">
                                <select id="pd-prom" name="product_prom">
                                    <option value="0" {if $pd.product_prom eq 0}selected{/if}>不参与秒杀</option>
                                    <option value="1" {if $pd.product_prom eq 1}selected{/if}>参与秒杀</option>
                                </select>
                                <div id="prom_option" class="{if $pd.product_prom eq 0}hidden{/if}" style="margin-top: 10px;">
                                    <div class='fv2Tip'>过期时间 例如：(2015-07-30 00:00)</div>
                                    <input type="text" class="gs-input" name="product_prom_limitdate" id="pd-form-msexp" value="{$pd.product_prom_limitdate}"/>
                                    <div class='fv2Tip' style="margin-top: 5px;">用户秒杀间隔，单位：天</div>
                                    <input type="text" class="gs-input" name="product_prom_limitdays" id="pd-form-msdays" value="{$pd.product_prom_limitdays}"/>
                                    <div class='fv2Tip' style="margin-top: 5px;">用户限购数量，单位：件</div>
                                    <input type="text" class="gs-input" name="product_prom_limit" id="pd-form-mscount" value="{$pd.product_prom_limit}"/>
                                    <div class='fv2Tip' style="margin-top: 5px;">秒杀折扣，必填选项，百分比（1-100）</div>
                                    <input type="text" class="gs-input" name="product_prom_discount" id="pd-form-discount" value="{$pd.product_prom_discount}"/>
                                </div>
                            </div>
                        </div>

                    </div>  

                    <div id="alterProductRight">
                        <div class="t1">商品首图</div>
                        <!-- 商品大图 -->
                        <a class="pd-image-sec" data-id="0" href="javascript:;"></a>
                        <div class="t2">建议使用500&#215;500尺寸图片 <a id="catimgPv" href="/uploads/product_hpic/1433819046557657a6967c4.jpeg">预览</a></div>
                    </div>

                </div>

                <div style="margin-top: 15px;">
                    <!-- 商品规格 -->
                    <div class="gs-label">商品规格 
                        <a id='pd-spec-edit-btn' class="fancybox.ajax" data-fancybox-type="ajax" href="{$docroot}?/WdminPage/ajax_alter_product_spec_detail/id={$pd.product_id}">选择</a>
                        {*                    <a id='pd-spec-edit-btn-rep' class="fancybox.ajax" data-fancybox-type="ajax" href="{$docroot}?/WdminPage/ajax_alter_product_spec_rep/id={$pd.product_id}">快速添加</a>*}
                    </div>

                    <!-- 商品规格表 -->
                    <table id='pd-spec-frame' style="{if $pd.specs|count eq 0}display:none;{/if}">
                        <thead>
                            <tr><th>规格</th><th>规格</th><th>价格</th><th>市场参考价</th></tr>
                        </thead>
                        <tbody>
                            {foreach from=$pd.specs item=specs}
                                <tr>
                                    <td>{$specs.name1}</td>
                                    <td>{$specs.name2}</td>
                                    <td><input type="text" onclick="this.select();" class="pd-spec-prices" data-id="{$specs.id1}-{$specs.id2}" value="{$specs.sale_price}"></td>
                                    <td><input type="text" onclick="this.select();" class="pd-spec-market" data-id="{$specs.id1}-{$specs.id2}" value="{$specs.market_price}"></td>
                                </tr>
                            {/foreach}
                        </tbody>
                    </table>
                </div>

            </div>
            <div style="padding: 0px 22px;" class="clearfix">
                <div class="gs-label">商品图集</div>
                <div id="pd-ilist" class="clearfix">
                    <a class="pd-image-sec ps20" data-id="1" href="javascript:;"></a>
                    <a class="pd-image-sec ps20" data-id="2" href="javascript:;"></a>
                    <a class="pd-image-sec ps20" data-id="3" href="javascript:;"></a>
                    <a class="pd-image-sec ps20" data-id="4" href="javascript:;"></a>
                    <a class="pd-image-sec ps20" data-id="5" href="javascript:;" style="margin-right: 0;"></a>
                </div>
                <div class="gs-label">详细介绍</div>
                <script style='width:100%;' id="ueditorp" type="text/plain" name="product_desc">{if $ed}{$pd.product_desc}{/if}</script>
            </div>
        </form>
        <div class="fix_bottom fixed">
            <a id="save_product_btn"  href="javascript:;" class="wd-btn primary">保存</a>
            {if $mod ne 'add'}<a class="wd-btn delete pd-del-btn" data-product-id="{$pd.product_id}">删除</a>{/if}
            <a onclick="location.href = $('#http_referer').val();" class="wd-btn default">返回</a>
        </div>
{include file='../__footer.tpl'} 